<template>
  <login-Register>
    <div class="register-wrap">
      <div style="text-alin:left; margin-bottom:1.1rem;">账号注册</div>
      <div class="login-group">
        <label for="phone">手机号</label>
        <div class="login-group-input-wrap">
          <el-input
             id="phone"
             v-model="phone"
             type="text"
             placeholder="请输入手机号"
             auto-complete="off"
             />
        </div>
        <br>
        <div class="login-group">
          <label for="email">邮箱</label>
          <div class="login-group-input-wrap">
            <el-input
              id="email"
              v-model="email"
              type="text"
              placeholder="请输入邮箱"
              auto-complete="off"
            />
          </div>
          <br>
          <div class="login-group">
            <label for="password">密码</label>
            <el-input
              id="password"
              type="password"
              v-model="password"
              placeholder="请输入密码"
              auto-complete="off"
            />
          </div>
          <br>
          <button class="login-button" @click="handleRegister">注册</button>
          <div class="login-floor">
            <el-link href="#/login" type="primary">使用已有账户登录</el-link>
          </div>
        </div>
      </div>
    </div>
    
  </login-Register>
</template>

<script>
import loginRegister from '../../components/loginRegister';

export default {
  components: { loginRegister },
  data() {
    return {
      phone: '',
      email: '',
      password: ''
      
    };
  },
  watch: {
    
  },
  methods: {
    async handleRegister() {
      var params = new Object();
      params.phone = this.phone;
      params.email = this.email;
      params.password = this.password;
      console.log(JSON.stringify(params)) 
      const{data: res} = await this.$http.post("/user/member/admin-register",JSON.stringify(params), {
          headers: {
            'Content-Type': 'application/json;charset=UTF-8',
          }
        });
      if(res.success) {
        this.$message.success("注册成功！");
        this.$router.push("/login");
      } else {
        this.$message.error(res.message);
      }
    }
  }
};
</script>

<style scoped>
@import url('../../assets/css/login.css');
.register-poptip {
  width: 100%;
  position: relative;
}
.register-poptip-content-progress {
  margin: 0 0 3px 0;
}
</style>
<style >
.register-wrap .ivu-poptip-rel {
  width: 100%;
}
.register-wrap .ivu-poptip-popper {
  width: 100% !important;
}
.register-wrap .ivu-poptip-body-content-inner {
  color: #000;
}
</style>
